package com.ganzi.ganziserver.service.imp;

import com.ganzi.ganziserver.core.SystemLog;
import com.ganzi.ganziserver.dao.SystemLogDao;
import com.ganzi.ganziserver.service.SystemLogService;
import com.ganzi.ganziserver.utils.GetTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SystemLogServiceImp implements SystemLogService {

    private static Logger log = LoggerFactory.getLogger(SystemLogService.class);

    @Autowired
    SystemLogDao logDao;

    @Override
    public void errorLog(String info) {
        try{
            SystemLog log = SystemLog.builder().information(info).createTime(GetTime.getNowTime()).build();
            logDao.insertSystemLog(log);
        }catch (Exception e){
            log.info("记录日志出错："+e.getMessage());
        }

    }
}
